﻿using System;
using System.Web.Http.Controllers;
using Enferno.Public.Web.Components.Server.Resolvers;
using Newtonsoft.Json;

namespace Enferno.Public.Web.Components.Server.Configuration
{
    public class ComponentsControllerConfigurationAttribute : Attribute, IControllerConfiguration
    {
        public void Initialize(HttpControllerSettings controllerSettings,
                               HttpControllerDescriptor controllerDescriptor)
        {
            controllerSettings.Formatters.JsonFormatter.SerializerSettings = new JsonSerializerSettings()
            {
                ContractResolver = new CamelCaseExceptDictionaryKeysResolver()
            };
        }
    }
}
